import threading
import time

def a(parm):
    print('a start')
    time.sleep(2)
    print('a end')

def b(parm):
    print('b start')
    time.sleep(2)
    print('b end')


def c():
    t1=threading.Thread(target=a,args=("",))
    t2=threading.Thread(target=b,args=("",))
    t1.setDaemon(true)

    t=time.time()
    t1.start()
    t2.start()
    print("cost time:{}".format(time.time()-t))


def d():
    t1=MyThreadA()
    t2=MyThreadB()


    t = time.time()
    t1.start()
    t2.start()
    print("cost time:{}".format(time.time() - t))


class MyThreadA(threading.Thread):
    def run(self):
        print('a start')
        time.sleep(2)
        print('a end')


class MyThreadB(threading.Thread):
    def run(self):
        print('b start')
        time.sleep(3)
        print('b end')


if __name__ == '__main__':
    d()